package com.vdimitr.happycube.puzzle.piece.match;

import com.vdimitr.happycube.puzzle.matrix.MatrixMatcher;
import com.vdimitr.happycube.puzzle.piece.PuzzlePiece;

/**
 * This class is responsible for determining if two puzzle pieces fit together
 * by attaching one puzzle piece's bottom side with the other puzzle piece's top
 * side
 * 
 * @author vasileios.dimitriadis
 * 
 */
public class PuzzlePieceTopToBottomMatcher {

	/**
	 * Determines if the two puzzle pieces can fit together by using their
	 * matrix representation to match them. That is if the bottom side of the
	 * top puzzle piece can match the top side of the bottom puzzle piece.
	 * 
	 * @param topPuzzlePiece
	 *            the puzzle piece on the top
	 * @param bottomPuzzlePiece
	 *            the puzzle piece on the bottom
	 * @return True if the two puzzle pieces fit
	 */
	public boolean puzzlePiecesMatchTopToBottom(PuzzlePiece topPuzzlePiece,
			PuzzlePiece bottomPuzzlePiece) {
		return MatrixMatcher.matricesMatchTopToBottom(
				topPuzzlePiece.getMatrix(), bottomPuzzlePiece.getMatrix());
	}

}
